package com.study.www.enums;

import com.study.www.service.ScheduleTaskService;

import java.util.Arrays;

public enum JobTypeEnum {

    TEST01("001", ScheduleTaskService.class,"test1"),
    TEST02("002",ScheduleTaskService.class,"test2");

    private String jobCode;

    private Class clazz;

    private String methodName;

    JobTypeEnum(String jobCode, Class clazz, String methodName) {
        this.jobCode = jobCode;
        this.clazz = clazz;
        this.methodName = methodName;
    }

    public String getJobCode() {
        return jobCode;
    }

    public Class getClazz() {
        return clazz;
    }

    public String getMethodName() {
        return methodName;
    }

    public static JobTypeEnum findByJobCode(String jobCode){
        return Arrays.stream(JobTypeEnum.values()).filter(item->jobCode.equals(item.jobCode)).findFirst().orElse(null);
    }
}
